package com.example.cdtutils;
import org.springframework.util.DigestUtils;

import java.util.Arrays;
import java.util.List;

public class SecretGen {
    static String operatorId = "699209552";
    static String[] secretKinds = new String[] {"OperatorSecret", "SigSecret",
            "DataSecret", "DataSecretIV"};

    // 打印秘钥的函数
    static void printSecret(String env) {
        for (String secretKind : secretKinds) {
            String rawStr = env + operatorId + secretKind;
            // MD5加密生成秘钥
            String md5Str = DigestUtils.md5DigestAsHex(rawStr.getBytes()).toUpperCase();
            System.out.println(md5Str.substring(8, 24));
        }
    }

    public static void main(String[] args) {
        // 打印DEV四个秘钥
        System.out.println("DEV秘钥：");
        printSecret("DEV");

        System.out.println("=================================");

        // 打印UAT四个秘钥
        System.out.println("UAT秘钥：");
        printSecret("UAT");
    }
}
